import auto from "./Api_Auto";
import config from "./Config";
let url = config.ApiUrl + "/api";

export default {
    //得到七牛的token，上传文件到七牛时使用
    GetQiniuToken: {
        method: "get",
        async: false,
        url: `${config.ApiUrl}/qiniu`,
    },

    //获取Me的数据
    GetMePermissionIDs: {
        method: "get",
        url: `${url}/User/GetMePermissionIDs`,
    },

    //获取Me的数据
    Me: {
        method: "get",
        url: `${url}/User/Me`,
    },

    //配置信息
    ConfigSetting: {
        GetConfig: function () {
            return {
                url: `${url}/ConfigSetting/GetConfig`,
                method: "get",
            };
        },
    },

    /******************************************************************************* 下面是系统业务相关 *******************************************************************************/

    GetClientID: function (loginname) {
        return {
            method: "get",
            url: `${url}/user/getclientid?loginname=${loginname}`,
        };
    },

    //Home 首页
    Home: {},
    //Hoister 提升机
    Hoister: {
        ...auto.Hoister,
    },

    //InstallAddress 安装地点
    InstallAddress: {
        ...auto.InstallAddress,
    },

    //Producer 制造商
    Producer: {
        ...auto.Producer,
    },

    //StandStatus 状态标准
    StandStatus: {
        ...auto.StandStatus,
    },

    //StandStatusDetail 状态标准明细
    StandStatusDetail: {
        ...auto.StandStatusDetail,
    },

    //Supplier 供应商
    Supplier: {
        ...auto.Supplier,
    },

    //Warehouse 仓库
    Warehouse: {
        ...auto.Warehouse,
        GetBySelect: (orderBy = "[Warehouse].[WarehouseID] ASC", top = -1) => {
            return {
                url: `${url}/Warehouse/GetBySelect?orderby=${orderBy}&top=${top}`,
                method: "POST",
                data: {},
            };
        },
    },

    //WarehousePosition 仓库库位
    WarehousePosition: {
        ...auto.WarehousePosition,
    },

    //WarehouseUser 仓库管理员
    WarehouseUser: {
        ...auto.WarehouseUser,
    },

    //Wirerope 钢丝绳
    Wirerope: {
        ...auto.Wirerope,
    },

    //Department 部门
    Department: {
        ...auto.Department,
        GetUserListByDepartmentID: function (departmentID) {
            return {
                url: `${url}/Department/GetUserListByDepartmentID/${departmentID}`,
                method: "get",
            };
        },
    },

    //dbo.DepartmentRole 角色与部门
    DepartmentRole: {
        ...auto.DepartmentRole,
    },

    //DepartmentUser 部门用户
    DepartmentUser: {
        ...auto.DepartmentUser,
        DeleteForSee: function (depID) {
            return {
                url: `${url}/DepartmentUser/DeleteForSee/${depID}`,
                method: "delete",
            };
        },
    },

    //Permission 权限
    Permission: {
        ...auto.Permission,
        GetAllPermissionByUserID() {
            return {
                url: `${url}/Permission/GetAllPermissionByUserID`,
                method: "get",
            };
        },
        GetAllPermissionByRoleID(id) {
            return {
                url: `${url}/Permission/GetAllPermissionByRoleID/${id}`,
                method: "get",
            };
        },
        SetPermission: {
            url: `${url}/Permission/SetPermission`,
            method: "put",
            data: {},
        },
    },

    //RefreshToken Token刷新记录
    RefreshToken: {
        ...auto.RefreshToken,
    },

    //Role 用户角色
    Role: {
        ...auto.Role,
    },

    //RoleDepartment 角色与部门
    RoleDepartment: {
        ...auto.RoleDepartment,
    },

    //RolePermission 角色与权限
    RolePermission: {
        ...auto.RolePermission,
    },

    //User 用户
    User: {
        ...auto.User,
        // 重置密码
        ResetPassword: function (orderBy, top) {
            return {
                url: url + "/User/ResetPassword",
                method: "post",
                data: {},
            };
        },
        // 修改密码
        ChagePass: function (orderBy, top) {
            return {
                url: url + "/User/EditPassword",
                method: "patch",
                data: {},
            };
        },
    },

    //UserRole 用户与角色
    UserRole: {
        ...auto.UserRole,
    },

    //HoisterUsage 提升用途
    HoisterUsage: {
        ...auto.HoisterUsage,
    },

    //Mpa 抗拉强度等级
    Mpa: {
        ...auto.Mpa,
    },

    //OperType 出入库业务类型
    OperType: {
        ...auto.OperType,
    },

    //SurfaceStatus 表面状态
    SurfaceStatus: {
        ...auto.SurfaceStatus,
    },

    //TwistingType 捻制类型
    TwistingType: {
        ...auto.TwistingType,
    },

    //WireropeKeepType 在用绳维保类型
    WireropeKeepType: {
        ...auto.WireropeKeepType,
    },

    //WireropeStruct 绳芯结构
    WireropeStruct: {
        ...auto.WireropeStruct,
    },

    //WireropeType 钢丝绳类型
    WireropeType: {
        ...auto.WireropeType,
    },

    //Area 区/县
    Area: {
        ...auto.Area,
    },

    //City 市
    City: {
        ...auto.City,
    },

    //DataDepartment 数据部门
    DataDepartment: {
        ...auto.DataDepartment,
    },

    //GroupInfo 集团
    GroupInfo: {
        ...auto.GroupInfo,
    },

    //Province 省
    Province: {
        ...auto.Province,
    },

    //Regulator 监管部门
    Regulator: {
        ...auto.Regulator,
    },

    //RegulatorData 数据权限
    RegulatorData: {
        ...auto.RegulatorData,
    },

    //RegulatorPermission 功能权限
    RegulatorPermission: {
        ...auto.RegulatorPermission,
    },

    //RegulatorUser 监管部门用户
    RegulatorUser: {
        ...auto.RegulatorUser,
    },

    //SuperUser 超级用户
    SuperUser: {
        ...auto.SuperUser,
    },

    //Message 消息
    Message: {
        ...auto.Message,
        CanJump: (id) => {
            return {
                url: `${url}/Message/CanJump/${id}`,
                method: "get",
            };
        },
    },

    //Bill 单据
    Bill: {
        ...auto.Bill,
    },

    //BillDetail 单据明细
    BillDetail: {
        ...auto.BillDetail,
    },

    //Stock 库存信息
    Stock: {
        ...auto.Stock,
        GetSearchs: (orderBy = "[x].[StockID] ASC", top = -1) => {
            return {
                url: `${url}/Stock/GetSearch?orderby=${orderBy}&top=${top}`,
                method: "POST",
                data: {},
            };
        },
    },

    //StockWireropeKeep 备绳维保
    StockWireropeKeep: {
        ...auto.StockWireropeKeep,
    },

    //ChangeWirerope 换绳
    ChangeWirerope: {
        ...auto.ChangeWirerope,
    },

    //CheckWirerope 在用绳检测
    CheckWirerope: {
        ...auto.CheckWirerope,
        Check: {
            url: `${url}/CheckWirerope/Check`,
            method: "POST",
            data: {},
        },

        GetPrevCheckWireropeModel: {
            url: `${url}/CheckWirerope/GetPrevCheckWireropeModel`,
            method: "POST",
            data: {},
        },
    },

    //CheckWireropeDetail 在用绳检测详情
    CheckWireropeDetail: {
        ...auto.CheckWireropeDetail,
    },

    //CheckWireropeDetailData 在用绳检测数据
    CheckWireropeDetailData: {
        ...auto.CheckWireropeDetailData,
    },

    //CheckWireropeDetailPosition 在用绳检测位置
    CheckWireropeDetailPosition: {
        ...auto.CheckWireropeDetailPosition,
    },

    //CheckWireropeStatusMonitor 在用绳检测状态
    CheckWireropeStatusMonitor: {
        ...auto.CheckWireropeStatusMonitor,
    },

    //UsingWirerope 在用绳档案
    UsingWirerope: {
        ...auto.UsingWirerope,
        GetSearchs: (orderBy = "[x].[UsingWireropeID] ASC", top = -1) => {
            return {
                url: `${url}/UsingWirerope/GetSearch?orderby=${orderBy}&top=${top}`,
                method: "POST",
                data: {},
            };
        },
        GetStatusMonitorPage: (pageIndex, pageSize, orderBy) => {
            return {
                url: `${url}/UsingWirerope/GetStatusMonitorPage?pageIndex=${pageIndex}&pageSize=${pageSize}&orderBy=${orderBy}`,
                method: "post",
                data: {},
            };
        },

        GetHomeData() {
            return {
                url: `${url}/UsingWirerope/GetHomeData`,
                method: "get",
            };
        },

        GetStatusMonitorByID: (id) => {
            return {
                url: `${url}/UsingWirerope/GetStatusMonitorByID/${id}`,
                method: "get",
            };
        },

        GetStatusMonitoryHistoryByID: (id) => {
            return {
                url: `${url}/UsingWirerope/GetStatusMonitoryHistoryByID/${id}`,
                method: "get",
            };
        },

        ExportLastCheckExcel: (id) => {
            return {
                url: `${url}/UsingWirerope/ExportLastCheckExcel/${id}`,
                method: "get",
            };
        },

        UpdateZuoFeiInfo: {
            url: `${url}/UsingWirerope/UpdateZuoFeiInfo`,
            method: "POST",
            data: {},
        },
    },

    //UsingWireropeKeep 在用绳维保
    UsingWireropeKeep: {
        ...auto.UsingWireropeKeep,
    },

    //UsingWireropeAttr 在用绳附件
    UsingWireropeAttr: {
        ...auto.UsingWireropeAttr,
    },
};
